<?php
defined('IN_IA') or exit('Access Denied');
//两个加载文件有顺序
include_once dirname(__FILE__) . '/autoload.inc.php';//自动加载类
include_once dirname(__FILE__) . '/common.php';//加载公共函数

class Yq_haircircleModuleSite extends WeModuleSite
{
    public function __construct()
    {
    }

    //访问的方法不能访问或不存在则会调用
    public function __call($name, $arguments)
    {
        $dir = IA_ROOT . '/addons/' . $this->modulename . '/inc/'; $sub = ''; $fun = '';

        $class = ModuleNamePascal() . '\controller\\';
        $name = str_replace('-', '\\', $name);
        stripos($name, 'doWeb') === 0 && ($sub = 'web\\') && ($fun = substr($name, 5));
        stripos($name, 'doMobile') === 0 && ($sub = 'mobile\\') && ($fun = $GLOBALS['_GPC']['do']/*substr($name, 8)*/);
        class_exists($class .= $sub . $fun) && (new $class($this, $arguments) && die || die);

        (0 === stripos($name, 'doWeb')) && ($sub = 'web/') && ($fun = /*strtolower*/(substr($name, 5)));
        (0 === stripos($name, 'doMobile')) && ($sub = 'mobile/') && ($fun = /*strtolower*/(substr($name, 8)));
        is_file($file = $dir . $sub . $fun . '.inc.php') && ((require $file) && die || die);

        (0 === stripos($name, 'doWeb')) && ($sub = 'web/') && ($fun = strtolower(substr($name, 5)));
        (0 === stripos($name, 'doMobile')) && ($sub = 'mobile/') && ($fun = strtolower(substr($name, 8)));
        is_file($file = $dir . $sub . $fun . '.inc.php') && ((require $file) && die || die);

        trigger_error("访问的方法：<br />\n \$file:{$file}<br />\n \$name:{$name}<br />\n \$class:{$class}<br />\n 不存在.", E_USER_WARNING);
        return null;
    }

    public function doWebIndex()
    {
        global $_W, $_GPC;
        include $this->template('index');
    }

    public function doWebWelcome()
    {
        global $_W, $_GPC;

        //任务
        $sql = "select sum(release_num) as tasksum,sum(receive_num) as receivesum from ims_yq_haircircle_task";
        $sql7 = "select count(*) as receivenow from ims_yq_haircircle_task_receive where receive_time > UNIX_TIMESTAMP(CAST(SYSDATE()AS DATE))";
        $sql8 = "select count(*) as tasknow from ims_yq_haircircle_task where create_time > UNIX_TIMESTAMP(CAST(SYSDATE()AS DATE))";
        $task = pdo_fetchall($sql);
        $receivenow = pdo_fetchall($sql7);
        $tasknow = pdo_fetchall($sql8);
        //用户
        $sql1 = "select count(*) as usersum,sum(user_level = '1') as vipsum,sum(user_money) as tixian_money from ims_yq_haircircle_users";
        $user = pdo_fetchall($sql1);
        //提现
        $sql2 = "select sum(cash_money) as cask_out_money_sum from ims_yq_haircircle_cashout where cash_status = 1";
        $cash = pdo_fetchall($sql2);
        $sql3 = "select sum(fxyj) as yong_money_sum from ims_yq_haircircle_user_fx_log";
        //佣金
        $yong_money = pdo_fetchall($sql3);
        $sql4 = "select count(receive_status) as daisum from ims_yq_haircircle_task_receive where receive_status = 2";
        $sql5 = "select count(*) as receivesum from ims_yq_haircircle_task_receive";
        $receive = pdo_fetchall($sql4);
        $receivesum = pdo_fetchall($sql5);
        //入账
        $sql6 = "select sum(payprice) as paymoney from ims_yq_haircircle_upgrade_order where is_true = 1";
        $paymoney = pdo_fetchall($sql6);
        include $this->template('welcome');
    }
}